package com.heima.comment.controller;

import com.heima.comment.service.IRepayService;
import com.heima.model.comment.dtos.CommentRepayLikeDto;
import com.heima.model.comment.dtos.CommentRepayDto;
import com.heima.model.comment.dtos.CommentRepaySaveDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.RequiredArgsConstructor;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @AuthOr: Anna Zhang
 * @Date:2024/8/22-12:00
 * @ClassName:com.heima.comment.controller
 * @Description:
 **/
@RestController
@RequestMapping("/api/v1/comment_repay")
@RequiredArgsConstructor
public class ApCommentRepayController {

    private final MongoTemplate mongoTemplate;
    private final IRepayService repayService;
    @PostMapping("/save")
    public ResponseResult saveRepay(@RequestBody CommentRepaySaveDto repaySaveDto){
        return repayService.saveRepayComment(repaySaveDto);
    }

    @PostMapping("/load")
    public ResponseResult loadRepayComment(@RequestBody CommentRepayDto repayDto){
        return repayService.loadRepayComment(repayDto);
    }

    @PostMapping("/like")
    public ResponseResult likeRepay(@RequestBody @Validated CommentRepayLikeDto repayLikeDto){
        return repayService.likeRepayComment(repayLikeDto);
    }
}
